<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="copyright" content="www.apicloud.com" />
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<title>舆情工作平台登陆</title>
<link rel="stylesheet" type="text/css" href="../css/login.css" />
<style>
	html {height: 100%;  }
	body { margin:0 auto; padding:0;height: 100%;width:100%; background:rgba(0,0,0,0.3);}	
	 
	#main{ line-height:26px; padding-top:5px;width: 90%; position: absolute; left:5%; bottom:0; }
	#method{-webkit-border-radius: 10px;border-radius:10px; text-align: center; border:1px solid #D4D3D3; padding: 10px 0px;margin-bottom: 10px;background-color: #fff;}	 
    
    .btn {margin:3px 10px;}
	.btn {background: fff;color: #A5A5A5; border:1px solid #B8B8B8;height: 40px; text-align: center; line-height: 40px; font-size: 20px;margin-top: 20px;border-radius: 5px;} 
	.btn:hover {background: red;color: #fff; border:1px solid #B8B8B8;height: 40px; text-align: center; line-height: 40px; font-size: 20px;margin-top: 20px;border-radius: 5px;} 
	
	.btn_x {margin:3px 10px;}
	.btn_x {background: red;color: #fff; border:1px solid #B8B8B8;height: 40px; text-align: center; line-height: 40px; font-size: 20px;margin-top: 20px;border-radius: 5px;} 
	.btn_x>span{ float: right; right:15%; position: absolute;} 
    
    .main{margin:3px 10px; text-align: left;text-indent: 2em;}
    
     #method ul {display: -webkit-box; display: -webkit-flex; display: flex;}
     #method ul li{position: relative;width:33.33%; height: 80px; margin-top:10px;list-style-type:none; }
     #method ul .btn1{background:url(../image/btn/qq.png) no-repeat; text-align:center; }
     #method ul .btn2{background:url(../image/btn/wx.png) no-repeat; text-align:center;}
     #method ul .btn3{background:url(../image/btn/dx.png) no-repeat; text-align:center;}
     #method ul li a{text-align:center; padding-left:20px; display:block; top:70px; position: absolute;}
</style>
</head>
<body tapmode="buyhover">
	<div id="header"></div>
   	<div id="main">
		<div id="method"> 
       	</div>
       	<div id="method" tapmode="buyhover" onclick="goto_closeFun()">取消</div>
	</div>	 
</body>
<script type="text/javascript" src="../script/api.js"></script>  
<script type="text/javascript" src="../script/alpenlicebe.js"></script>   
<script type="text/javascript" src="../script/zepto.min.js"></script>
<script type="text/javascript" src="../script/hashes.min.js"></script> 
<script type="text/javascript">
	function goto_closeFun(){
		api.closeFrame({name: 'yq_menuBottomMore'});
	}
   	apiready = function(){   
   		
		var infoID = api.pageParam.infoID; 
       	var menuType = api.pageParam.menuType;  
		if(''==infoID||undefined==infoID||null==infoID){
    		api.alert({title:'系统提示',msg:'参数错误'});
			return;
    	}  
       	/*处置*/            
		if(menuType == 1){
			/*处置状态*/
       		var deal_status = api.pageParam.deal_status; 
       		
            if(deal_status == 0){
               	$("#method").html('<div class="title">设置状态</div><div class="btn" tapmode="buyhover" onclick="goto_infoFun(1)">处置中</div><div class="btn" tapmode="buyhover" onclick="goto_infoFun(2)">处置完毕</div>'); 		  
            }
            if(deal_status == 1){
            	/*deal_status=1 forwarding_status=0  处置中未转办区县
				deal_status=1 forwarding_status=1  处置中已转办区县，区县未提交
				deal_status=1 forwarding_status=2  处置中转办区县，并且区县已提交
				deal_status=2 forwarding_status=3  处置完毕
				*/ 
       			var forwarding_status = api.pageParam.forwarding_status;
       			var deal_result = api.pageParam.deal_result;
       			var feedback = api.pageParam.feedback;
       			if('2'==forwarding_status){
               		$("#method").html('<div class="title">设置状态</div><div class="btn_x" >处置中<span>√</span></div><div class="btn" tapmode="buyhover" onclick="goto_infoFun(2)">处置完毕(审核中)</div>'); 		  
            	}else{
            		$("#method").html('<div class="title">设置状态</div><div class="btn_x" >处置中<span>√</span></div><div class="btn" tapmode="buyhover" onclick="goto_infoFun(2)">处置完毕</div>');
            	}
            } 
       	}
       	if(menuType == 2){
			/*申请状态*/
			var is_pass = api.pageParam.is_pass;
			/*申请进度*/
       		var pass_status = api.pageParam.pass_status;
 
            if(is_pass == 0){
            	/*如果可以申请，显示申请信息，否则显示申请进度*/
           		$("#method").html('<div class="title">标无效申请</div><div class="main">若此条信息不属于自己的处置范围或无法处置，可以申请将此信息标为无效，审核通过后删除此信息。</div><div class="btn" tapmode="buyhover" onclick="goto_noUseInfoFun_funOK()">确认申请</div>'); 		  
            }else{
                if(pass_status == 0){
                      //$("#method").html('<div class="title">标无效申请</div><div class="main">若此条信息不属于自己的处置范围或无法处置，可以申请将此信息标为无效，审核通过后删除此信息。</div><div class="btn" tapmode="buyhover" onclick="goto_noUseInfoFun_funOK()">确认申请</div>');
                      $("#method").html('<div class="title">标无效申请</div><div class="main">申请状态：已申请</div><div class="main" >审核状态：审核中</div>'); 		              
                } 
            }
       	}
		if(menuType == 99){
       		var tmp='<ul>'+
       					'<li class="btn1" tapmode="activebtn0 activebtn" onclick="goto_fx(0)"><a class="bottom_btn bbtn01 weixin">QQ</a></li>'
       					+'<li class="btn2" tapmode="activebtn1 activebtn" onClick="goto_fx(1)"><a class="bottom_btn bbtn02 communicate">微信</a></li>'
       					+'<li class="btn3" tapmode="activebtn2 activebtn" onClick="goto_fx(2)"><a class="bottom_btn bbtn03 discover">短信</a></li>'
       					+'</ul> ';
			$("#method").html(tmp);	  
		}             
	}
    
 
	function goto_infoFun(goType) {
		var infoID = api.pageParam.infoID;   
		if(''==infoID||undefined==infoID||null==infoID){
    		api.alert({title:'系统提示',msg:'参数错误'});
			return;
		} 	    
	   	api.openWin({
          	name: 'yq_listDetail_Deal',
          	url: './yq_listDetail_Deal.html',
          	delay: 300,
          	pageParam:{infoID:infoID,goType:goType},
          	bounces: false,
      	}); 	
	}
	
	/*标记无效*/
	function goto_noUseInfoFun_funOK(){
		var infoID = api.pageParam.infoID;   
		if(''==infoID||undefined==infoID||null==infoID){
    		api.alert({title:'系统提示',msg:'参数错误'});
			return;
    	}
		api.showProgress({
		    style: 'default',
		    animationType: 'fade',
		    title: '',
		    text: '',
		    modal: false
		});
		var MD5 = new Hashes.MD5;   
       	var access_token = Alpe_getLocalStorge("access_token");                     
       	var admin_id = Alpe_getLocalStorge("admin_id"); 
       	var sign = MD5.hex(access_token+admin_id+infoID+'datas/setPass1.0syjqingbao');
          
       	var url = Alpe_ApiUrl+'r=datas/setPass&access_token='+access_token+'&admin_id='+admin_id
       		+'&message_id='+infoID 
       		+'&v=1.0&sign='+sign;
       		 
       	api.ajax({
	         url: url,
	         method: 'post',
	         cache: false,
	         timeout: 30,			
	         dataType: 'json'
       	}, function(ret_a, err_a){  
       		api.hideProgress(); 
			if (ret_a) {	 
				api.toast({
		     		msg: ret_a.message,
                    duration:2000,
                    location: 'middle'
                }); 
                if(ret_a.success == "101"){
                	$("#method").html('<div class="title">标无效申请</div><div class="main">申请状态：已申请</div><div class="main" >审核状态：审核中</div>');
            		api.sendEvent({
					    name: 'Alpe_Event_yq_dosomething',
					    extra:{
						    keyID:'alpenlicebe' 
						}
					}); 
            		api.closeFrame({name: 'yq_menuBottomMore'});
                } 
		  		
			}else{
				api.alert({title:'系统提示',msg:'错误请重试'});
			} 
   		});
	}
	function goto_fx(fxType){
		var url = api.pageParam.url; 
	  	var title = api.pageParam.title; 
	  	var content = api.pageParam.content; 
	  
	  	if(fxType == 0){ 
   			goto_fx_qq(url,title,content); 
	  	}
	  	if(fxType == 1){ 
   			goto_fx_wx(url,title,content); 
	  	}
	 	if(fxType == 2){ 
			api.sms({
         		numbers: [''],
           		text: '分享自舆情处置平台,【'+title+'】'+url
       		});
	  	} 
	}
	function goto_fx_wx(url,title,content){
		try
		{ 
			if(undefined==content||null==content||''==content){
				content='暂无';
			}
			var weiXin = api.require('weiXin');
			weiXin.registerApp(
			    function(ret,err){ 
			        if (ret.status) {
			            weiXin.sendRequest({
						    scene:'session',/*timeline*/
						    contentType:'web_page',
						    title:title,
						    description:content,
						    thumbUrl:'widget://res/logo_fx.png',
						    contentUrl:url
						},function(reta,erra){  
						    if(reta.status){
						        api.alert({title: '系统提示',msg: '分享成功', buttons: ['确定']});
						    } else{
						        //api.alert({title: '系统提示',msg: erra.code,buttons: ['确定']});
						    };
						});
			        } else{
			            api.alert({title: '系统提示',msg: err.msg,buttons: ['确定']}); 
			        }
			    }
			);  
		}
		catch(rr){
			api.alert({title: '系统提示',msg: rr.message,buttons: ['确定']});
		}
	}
	function goto_fx_qq(url,title,content){ 
		if(undefined==content||null==content||''==content){
			content='暂无';
		}
		var obj = api.require('qq'); 
		obj.shareNews({
			url:url,
			title:title,
			description:content,
			imgUrl:'widget://res/logo_fx.png',				        
		    type:'QFriend'
		},function(ret_fx,err_fx){
			if(ret_fx.status){
				api.alert({title: '系统提示',msg: '分享成功', buttons: ['确定']});
			}else{
				api.alert({title:'系统提示',msg:err_fx.msg});  
			}
		});          
	} 
</script>
</html>